const db = require('./db')

// 注册
const addUser = (params) => {
  return new Promise((resolve, reject) => {
    let sql =
      'insert into users (username,pwd,age,phone,email) values (?,?,?,?,?)'
    db.query(
      sql,
      [params.username, params.pwd, params.age, params.phone, params.email],
      (err, result) => {
        if (err) {
          reject(err)
        } else {
          resolve(result)
        }
      }
    )
  })
}
module.exports = {
  addUser,
}
